
# RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:09:19 $
#           $Source: /users/faustus/xchess/RCS/Makefile,v $
# Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#
# Makefile for xchess.

CC = cc

CFILES	=\
	board.c\
	button.c\
	clock.c\
	control.c\
	jail.c\
	message.c\
	parse.c\
	popup.c\
	program.c\
	record.c\
	std.c\
	valid.c\
	window.c\
	XCircle.c

COBJS	=\
	board.o\
	button.o\
	clock.o\
	control.o\
	jail.o\
	message.o\
	parse.o\
	popup.o\
	program.o\
	record.o\
	std.o\
	valid.o\
	window.o\
	XCircle.o

HFILES	=\
	std.h\
	xchess.h

SOURCE = $(CFILES)

ALLFILES = $(SOURCE) $(HFILES)

INCLUDE = -I.

DEFINES = -DDEF_PROGRAM=\"/usr/public/gnuchess\"

CFLAGS = $(DEFINES) $(INCLUDE) -g -pg
LINTFLAGS = -u -z -lc -DLINT $(DEFINES) $(INCLUDE)
LINTLIB = ../lib/llib-lX.ln
LDFLAGS = -z -lXMenu -lX -lm -g
GPLDFLAGS = -z -lXMenu_p -lX -lm_p -g -pg

.c.o: $*.c
	$(CC) $(CFLAGS) -pg -c $*.c
.s.o: $*.s
	$(CC) $(CFLAGS) -pg -c $*.s

all: xchess scrollText/scrollText.a
	@echo "All done."

everything: all tags depend lint wc
	@echo "All done."

xchess:	xchess.o $(COBJS) scrollText/scrollText.a
	$(CC) -o xchess xchess.o $(COBJS) scrollText/libScroll.a \
	$(LDFLAGS)

scrollText/scrollText.a:
	cd scrollText; make; cd ..

gpxchess: xchess.o $(COBJS)
	$(CC) -o gpxchess xchess.o $(COBJS) scrollText/libScroll.a \
	$(GPLDFLAGS)

lint:	$(SOURCE)
	lint $(LINTFLAGS) $(SOURCE) $(LINTLIB) | \
	grep -v "multiply declared"

qgrind: $(ALLFILES)
	qgrind -lc $(ALLFILES)

vgrind:	$(ALLFILES)
	vgrind -lc $(ALLFILES)

opt: all

reopt: all

install: all

source:	$(SOURCE) 

tags: $(ALLFILES)
	ctags -w -t *.c *.h > /dev/null 2>&1

wc: $(ALLFILES)
	@wc $(ALLFILES)

print: $(ALLFILES)
	@pr $(ALLFILES)

clean:
	rm -f *.o *.a *.out xchess tags foo tmp

tar:
	tar -cvf xchess.tar Makefile *.h *.c *.bitmap *.icon *.cur *.1\
	scrollText/Makefile scrollText/*.h scrollText/*.c scrollText/*.1\
	scrollText/*.3

$(ALLFILES):
	co $@

depend: $(SOURCE)
	cc -M $(CFLAGS) $(CFILES) > makedep
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	ed - Makefile < eddep
	rm eddep makedep 
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see make depend above' >> Makefile

#-----------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend uses it
# DEPENDENCIES MUST END AT END OF FILE

xchess.o $(COBJS): $(HFILES)

